#ifndef STX_SYSTEM_ERROR_HPP
#define STX_SYSTEM_ERROR_HPP

#include <stdexcept>
#include <string>

namespace stx {

class system_error: public std::runtime_error
{
public:
    
    typedef std::runtime_error base_class;
    
    explicit system_error(const std::string& message, int code):
        base_class(message),
        code_(code)
    {
    }
    
    virtual ~system_error() throw()
    {
    }
    
    virtual const char *what() const throw()
    {
        return base_class::what();
    }
    
    int code() const
    {
        return code_;
    }
    
private:
    
    int code_;
    
};

} // namespace stx

#endif // STX_SYSTEM_ERROR_HPP
